package com.it.share;

import cn.hutool.json.JSONUtil;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class App  {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext content = new AnnotationConfigApplicationContext(AppConfig.class);

        JdbcTemplate jdbcTemplate = content.getBean(JdbcTemplate.class);


        List<Integer> list = jdbcTemplate.query("select 1", (rs, rowNum) -> {
            int i = rs.getInt(1);
            return i;
        });

        System.out.println(JSONUtil.toJsonStr(list));
    }


}
